2.8 [Rule] Sections
The optional [Rule]
sections in the FDF file are used for combining binary
images, not for compiling code. Rules are use with the [FV]
section's module
INF type to define how an FFS file is created for a given INF file. The EDK II
Build Specification defines the default rules that are implicitly used for
creating FFS files. The implicit rules follow the PI Specification and
UEFI Specification.
The [Rule]
section of the FDF file is used to define custom rules, which may
be applied to a given INF file listed in an [FV]
section. This section is
also used to define rules for module types that permit the user to define the
content of the FFS file - when an FFS type is not specified by either PI or
UEFI specifications.
The Rules can have multiple modifiers as shown below.
[Rule.ARCH.MODULE_TYPE.TEMPLATE_NAME]
If no TEMPLATE_NAME
is given then the match is based on ARCH
and
MODULE_TYPE
modifiers. BINARY
is a reserved TEMPLATE_NAME
as a default rule
name for binary modules. The TEMPLATE_NAME
must be unique to the ARCH
and
MODULE_TYPE
. It is permissible to use the same TEMPLATE_NAME
for two or
more [Rule]
sections if the ARCH
or the MODULE_TYPE
listed are different
for each of the sections.
A [Rule]
section is terminated by another section header or the end of file.
The content of the [Rule]
section is based on the FILE
and section grammar
of the FV section. The difference is the FILE
referenced in the [RULE]
is a
MACRO
. The section grammar is extended to include an optional argument,
Optional
. The Optional
argument is used to say a section is optional. That
is to say, if it does not exist, then it is O.K.
Note: The !include
statement is valid for any part of the [Rule]
section, including an entire [Rule]
section.
The generic form of the entries for leaf sections is:
<SectionType> <FileType> [Options] [{<Filename>} {<Extension>}]
When processing the FDF file, the following rules apply (in order):
- If
<SectionType>
not defined or not a legal name, then error - If
<FileType>
not defined or not a legal name, then error - If
[FilePath/FileName]
, then: Add one section to FFS with a section type of<SectionType>
Else: Find all files defined by the INF file whose file type is
<FileType>
and add each one to the FFS with a section type of<SectionType>
in alphabetical order. Add files defined in[Sources]
followed by files defined in[Binaries]
If > 1
UI
section in final FFS, then error- If > 1
VER
section in final FFS, then error - If > 1
PEI_DEPEX
section in final FFS, then error - If > 1
DXE_DEPEX
section in final FFS, then error - If > 1
SMM_DEPEX
section in final FFS, then error
If a rule specifies a file type, instead of specifying specific file names, the files that match the extension must be processed in alphabetical order.
Example
[Rule.Common.ACPITABLE]
FILE FREEFORM = $(NAMED_GUID) {
RAW ACPI Optional |.acpi
RAW ASL Optional |.aml
}
Tools must add the processed .acpi files alphabetically, followed by the .aml files which must also be added alphabetically.
The file would contain:
<SOF>a1.acpi, a2.acpi, b1.acpi, b2.acpi, a.aml, b.aml<EOF>
where, start of file is <SOF>
and end of file is <EOF>
Refer to the EDK II INF File Specification for a description of the
FileType
for binary files.